package com.tree.shardingjdbc.demo.service.impl;

import com.tree.shardingjdbc.demo.entity.UserEntity;
import com.tree.shardingjdbc.demo.repository.UserRepository;
import com.tree.shardingjdbc.demo.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName com.tree.shardingjdbc.demo.service.impl
 * Description: <类功能描述>. <br>
 * <p>
 * <使用说明>
 * </p>
 * @Author tree
 * @Date 2019-06-02 23:57
 * @Version 1.0
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserRepository userRepository;

    @Override
    public UserEntity saveUser(UserEntity user) {
        return userRepository.save(user);
    }

    @Override
    public List<UserEntity> getUsers() {
        List<UserEntity> users = userRepository.findAll();
        return users;
    }
}
